/**
 */
package org.xtext.context.aware.eventX.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.xtext.context.aware.eventX.EventXPackage;
import org.xtext.context.aware.eventX.Vibrate;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Vibrate</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.context.aware.eventX.impl.VibrateImpl#getVibrate <em>Vibrate</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.VibrateImpl#isHasDuration <em>Has Duration</em>}</li>
 *   <li>{@link org.xtext.context.aware.eventX.impl.VibrateImpl#getDuration <em>Duration</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class VibrateImpl extends MinimalEObjectImpl.Container implements Vibrate
{
  /**
   * The default value of the '{@link #getVibrate() <em>Vibrate</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVibrate()
   * @generated
   * @ordered
   */
  protected static final String VIBRATE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getVibrate() <em>Vibrate</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVibrate()
   * @generated
   * @ordered
   */
  protected String vibrate = VIBRATE_EDEFAULT;

  /**
   * The default value of the '{@link #isHasDuration() <em>Has Duration</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasDuration()
   * @generated
   * @ordered
   */
  protected static final boolean HAS_DURATION_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isHasDuration() <em>Has Duration</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isHasDuration()
   * @generated
   * @ordered
   */
  protected boolean hasDuration = HAS_DURATION_EDEFAULT;

  /**
   * The default value of the '{@link #getDuration() <em>Duration</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDuration()
   * @generated
   * @ordered
   */
  protected static final String DURATION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDuration() <em>Duration</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDuration()
   * @generated
   * @ordered
   */
  protected String duration = DURATION_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected VibrateImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EventXPackage.Literals.VIBRATE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getVibrate()
  {
    return vibrate;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setVibrate(String newVibrate)
  {
    String oldVibrate = vibrate;
    vibrate = newVibrate;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.VIBRATE__VIBRATE, oldVibrate, vibrate));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isHasDuration()
  {
    return hasDuration;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHasDuration(boolean newHasDuration)
  {
    boolean oldHasDuration = hasDuration;
    hasDuration = newHasDuration;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.VIBRATE__HAS_DURATION, oldHasDuration, hasDuration));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDuration()
  {
    return duration;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDuration(String newDuration)
  {
    String oldDuration = duration;
    duration = newDuration;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EventXPackage.VIBRATE__DURATION, oldDuration, duration));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EventXPackage.VIBRATE__VIBRATE:
        return getVibrate();
      case EventXPackage.VIBRATE__HAS_DURATION:
        return isHasDuration();
      case EventXPackage.VIBRATE__DURATION:
        return getDuration();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EventXPackage.VIBRATE__VIBRATE:
        setVibrate((String)newValue);
        return;
      case EventXPackage.VIBRATE__HAS_DURATION:
        setHasDuration((Boolean)newValue);
        return;
      case EventXPackage.VIBRATE__DURATION:
        setDuration((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EventXPackage.VIBRATE__VIBRATE:
        setVibrate(VIBRATE_EDEFAULT);
        return;
      case EventXPackage.VIBRATE__HAS_DURATION:
        setHasDuration(HAS_DURATION_EDEFAULT);
        return;
      case EventXPackage.VIBRATE__DURATION:
        setDuration(DURATION_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EventXPackage.VIBRATE__VIBRATE:
        return VIBRATE_EDEFAULT == null ? vibrate != null : !VIBRATE_EDEFAULT.equals(vibrate);
      case EventXPackage.VIBRATE__HAS_DURATION:
        return hasDuration != HAS_DURATION_EDEFAULT;
      case EventXPackage.VIBRATE__DURATION:
        return DURATION_EDEFAULT == null ? duration != null : !DURATION_EDEFAULT.equals(duration);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (vibrate: ");
    result.append(vibrate);
    result.append(", hasDuration: ");
    result.append(hasDuration);
    result.append(", duration: ");
    result.append(duration);
    result.append(')');
    return result.toString();
  }

} //VibrateImpl
